package com.easy.dev.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.easy.dev.entity.Test;
import com.easy.dev.service.impl.BaseServiceImpl;
import com.easy.dev.service.impl.TestServiceImpl;
import com.easy.dev.vo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;

@Api(tags = "用户操作接口")
@RestController
@RequestMapping("/test")
public class TestController extends BaseController<Test>{

    public BaseServiceImpl getService() {
        return this.testService;
    }

    @ApiOperation(value = "获取otp", notes="通过手机号获取OTP验证码")
    @ApiImplicitParam(name = "telephone", value = "电话号码", paramType = "query", required = true, dataType = "Integer")
    @GetMapping("/test2")
    public Result getResult1(){
        System.out.println("111112345");
        return null;
    }

    @Autowired
    private TestServiceImpl testService;


    @GetMapping("/test")
    public void testSelect() {
        System.out.println(("----- selectAll method test ------"));
        QueryWrapper wrapper = new QueryWrapper();
        wrapper.eq("1",1);
        List<Test> testList = testService.selectList(wrapper);
        testList.forEach(System.out::println);
    }

    @GetMapping("/one")
    public void getOne() {
        System.out.println(("----- selectAll method test ------"));
        QueryWrapper<Test> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("id",1);
        Test test = (Test)testService.selectOne(queryWrapper);
        System.out.println(test);
    }

}
